<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>vue3-escook</title>
  <link rel="stylesheet" href="./lib/style.css">
  <script type="importmap">
    {
      "imports" : {
        "vue": "./lib/vue-3.4.29.js"
      }
    }
  </script>
  <script type="module">
    import { createApp, ref } from 'vue'

    const app = createApp({
      setup() {
        const msg = ref('hello')
        const iptHandler = (e) => {
          msg.value = e.target.value
        }

        const age = ref(1)

        return {
          msg,
          iptHandler,
          age
        }
      }
    })

    app.mount('#app')
  </script>
</head>

<body>
  <div id="app">
    <h1>{{ msg }}</h1>
    <!-- 手动实现双向数据绑定： -->
    <!-- v-bind 属性绑定 + @ 事件监听 -->
    <input type="text" :value="msg" @input="iptHandler">
    <hr>
    <!-- 默认情况下，v-model 指令监听的是 input 元素的 @input 输入事件 -->
    <input type="text" v-model.lazy="msg">
    <hr>
    <input type="number" v-model="age">

    <hr>

    <input type="text" v-model.trim.lazy="msg">
  </div>
</body>

</html>